#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>
void ReplaceSpace(char* str, int length)
{
	char* cur = str;
	int Space_Count = 0;
	while (*cur)
	{
		if (*cur == ' ')
		{
			Space_Count++;
		}
		cur++;
	}
	char* end1 = str + length;
	char* end2 = str + length + Space_Count * 2;
	while (end1 != end2)
	{
		if (*end1 != ' ')
		{
			*end2-- = *end1--;
		}
		else
		{
			*end2-- = '0';
			*end2-- = '2';
			*end2-- = '%';
			end1--;
		}
	}
}
int main()
{
	char arr[20] = "We are happy";
	int length = strlen(arr);
	ReplaceSpace(arr, length);
	printf("%s\n",arr);
	return 0;
}


